See environment_setup.README (below) for instructions about the use of the DC3_plots_NALMA script. It is a version of the script used to process the DC3 dataset as in Barth et al. (2015, BAMS) and Bruning and Thomas (2015, JGR).
The flash sorting infrastructure is modular. This script uses the DBSCAN algorithm as implemented in the scikit-learn machine-learning library. In order to manage the $N^2$ efficiency of the underlying DBSCAN implementation, data are clustered in pairs of thresh_duration
chunks.
The script is configurable in a few places.
base_sort_dir
sets the path where center_ID
chooses a network center. The centers are defined in the centers
dictionary. The ID is used later when constructing output filenames, too.params
dictionary configures the flash sorting algorithm. Of particular importance are the following.stations
: sets the (min, max) number of stations that must participate in each solution for it to count. Max should be larger than the number of stations. Min should be six or seven, depending on the number of stations.chi2
: sets the (min, max) chi-squared value. The minimum should be zero, while a good maximum to start with is 1.0.distance
: maximum distance between a source and its closest neighbor before a new flash is startedthresh_critical_time
: maximum temporal separation between a source and its closest neighbor before a new flash is startedthresh_duration
: All flashes should be last less than or equal to this number of seconds. All flashes of duration < thresh_duration
are guaranteed to remain clustered. An occasional lucky flash of duration = 2 * thresh_duration
is possible.The script is broken into three sections.
The grid spacing, boundaries, and frame intervals are configured at the begining of the gridding section of the script. This script creates regularly-spaced lat/lon grids, with the center grid cell size calculated to match the specified dx_km
and dy_km
. It is also possible to grid directly in a map projection of choice by changing proj_name
, as well as x_name
and y_name
in the call to make_plot
. For instance, a geostationary projection can be obtained with proj='geos'
as described in the documentation for the proj4 coordinate system library.
The PDF images are created as small-multiple plots, with the number of columns given by n_cols
at the beginning of the plotting section.
An example of reading and working with the resulting data files is found in the "Reading the flash-sorted files.ipynb"
As described below, additional scripts perform follow-on analysis.
The IOP bounding box file included here is a rectangular lat/lon box, but the underlying code works with arbitrary polygons. Adapting the existing code to polygons is mostly a matter of reading in polygon vertices and sending its vertices instead of those for a rectangle.
In [3]:
%%bash
cat /data/GLM-wkshp/flashsort/environment_setup.README
In [12]:
# Links to representative PDFs.
from IPython.display import display, HTML, Image
class PDF(object):
def __init__(self, filename):
self.filename = filename
def _repr_pdf_(self):
return open(self.filename, 'rb').read()
In [16]:
base_path = '/data/GLM-wkshp/flashsort/figures-length/IOPsupercell18-AL-20090410-boundingbox-thresh-0.15_dist-3000.0_pts-10/'
Locations of all flashes contributing to the analyses
Lets you identify that only one cell was tracked
In [18]:
Image(base_path+'flashes.png')
Out[18]:
Time-height plot, separated by IC and CG.
There are accompanying ASCII data files with the raw data. Uses the technique in Bruning and Thomas (2015, JGR)
In [10]:
PDF(base_path+'D-1.7_b-0.25_length-profiles_CG.pdf')
Out[10]:
In [11]:
PDF(base_path+'D-1.7_b-0.25_length-profiles_IC.pdf')
Out[11]:
Time series of flash moments
There are accompanying ASCII data files with the raw data. Uses the technique in Bruning and Thomas (2015, JGR).
In [24]:
PDF(base_path+'moment-energy-timeseries.pdf')
Out[24]:
In [25]:
import pandas as pd
pd.read_csv(base_path+'../IOPsupercell18-output.flash_stats.csv')
Out[25]:
Plots of each minute in the gridded data
LMA source density, flash extent density, flash initation density, and average flash area.
In [23]:
Image(base_path+'/grids_lma_source/lma_source_20090410_185300.png')
Out[23]:
In [20]:
Image(base_path+'/grids_flash_extent/flash_extent_20090410_185300.png')
Out[20]:
In [21]:
Image(base_path+'/grids_flash_initiation/flash_initiation_20090410_185300.png')
Out[21]:
In [22]:
Image(base_path+'/grids_flash_footprint/flash_footprint_20090410_185300.png')
Out[22]:
Each of the grid type folders contains a CSV file with statistics of the pixels making up the image.
In [29]:
pd.read_csv(base_path+'/grids_flash_extent/flash_extent_20090410.csv')
Out[29]:
Flash energy spectra
Plots of the flash energy spectra as defined in Bruning and MacGorman (2013, JAS). A 5/3 power law reference line is plotted.
In [32]:
PDF(base_path+'LYLOUT_090410_180000_3600-energy.pdf')
Out[32]:
In [ ]: